<%--
  Created by IntelliJ IDEA.
  User: Gaara_XHG
  Date: 2020/10/13
  Time: 14:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>上传车辆介绍图片（）</title>
    <link rel="stylesheet" type="text/css" href="/prj/plugins/layui/css/layui.css">
</head>
<body>
<%--        ngix实现多图片上传begin--%>
<div class="layui-upload">
    <button type="button" class="layui-btn" id="test2">车辆介绍图片上传（最多上传4张）</button>
    <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
        预览图：
        <div class="layui-upload-list" id="demo2"></div>
    </blockquote>
</div>
<%--        ngix实现多图片上传end--%>
<%--返回管理员页面--%>
<div>
    <a href="${pageContext.request.contextPath}/AdminJsp/toAdmin">返回管理员页面</a>
</div>

<script src="${pageContext.request.contextPath}/plugins/jquery/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/layui/layui.js"></script>

<script>
    layui.use('upload',function(){
        let upload = layui.upload;//初始化
        let element = layui.element;//初始化进度条
        //多图片上传
        upload.render({
            elem: '#test2'
            ,url: '/prj/uploadCar/carJyDesc/addMany/nginx/${carID}' //改成您自己的上传接口
            ,multiple: true
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img" style="width: 200px;height: 200px;padding-right: 20px">')
                });
            }
            ,done: function(res){
                //上传完毕
            }
        });
    })

</script>

</body>
</html>
